package com.yadang.service;

/**
 * @author: 亚当
 * @date: 2023年04月25日 22:59
 * @package: com.yadang.service
 * @Description: TODO
 */
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.jms.Session;
import java.beans.Transient;

@Service
public class MessageSenderService {

    @Autowired
    private JmsTemplate jmsTemplate;

    @Transactional
    public void sendMessage(String destination, String message) {
        jmsTemplate.send(destination, session -> session.createTextMessage(message));
    }
}
